import CYRequest from './request'
import { BASE_URL, TIME_OUT } from './request/config'

const myRequest = new CYRequest({
  baseURL: BASE_URL,
  timeout: TIME_OUT,
  interceptors: {
    requestInterceptor: (config) => {
      // 携带token的拦截
      const token = ''
      if (token) {
        config.headers.Authorization = `Bearer ${token}`
      }
      // console.log('拦截请求信息成功')
      return config
    },
    responseInterceptor: (res) => {
      // console.log('拦截响应数据成功')
      return res
    }
  }
})

export default myRequest
